//
//  CinemaViewController.m
//  个人项目(豆瓣元旦作业)
//
//  Created by dllo on 15/12/31.
//  Copyright © 2015年 guoguo. All rights reserved.
//

#import "CinemaViewController.h"
#import "CinemaHGTableViewCell.h"
@interface CinemaViewController ()<UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, retain) UITableView *tableView;
@property (nonatomic, retain) NSMutableArray *arr;
@end

@implementation CinemaViewController

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.navigationItem.title = @"影院";
    self.navigationController.navigationBar.translucent = NO;
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:30/255.0 green:174/255.0 blue:230/255.0 alpha:1];
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    [self.view addSubview:_tableView];
    
    //注册
    [_tableView registerClass:[CinemaHGTableViewCell class] forCellReuseIdentifier:@"cell"];
    
    //数据处理
    NSString *path = [[NSBundle mainBundle] pathForResource:@"cinema" ofType:@"plist"];
    
    self.arr = [NSMutableArray arrayWithContentsOfFile:path];
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return _arr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    CinemaHGTableViewCell *cell = [[CinemaHGTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
    
    cell.imageView1.image = [UIImage imageNamed:@"bg_eventlistcell@2x.png"];
    
    cell.label1.text = _arr[indexPath.row][@"cinemaName"];
    cell.label2.text = _arr[indexPath.row][@"address"];
    cell.label3.text = _arr[indexPath.row][@"telephone"];
    
    
    
    return cell;
    
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 200;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
